package com.yh.threadTest.pojo;

/**
 * @ClassName MyThread2
 * @Description TODO
 * @Author 0715-YuHao
 * @Date 2020/11/14 10:15
 */
public class MyThread2 implements Runnable {

    private Integer num;

    public MyThread2() {
    }

    public MyThread2(Integer num) {
        this.num = num;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            num++;
            System.out.println(num);
        }
    }

    public static void main(String[] args) {
        Integer num = new Integer(2);
        MyThread2 r = new MyThread2(num);
        new Thread(r).start();
        try {
            Thread.sleep(100);
            System.out.println(num);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
